import { Injectable } from '@angular/core';
import { AlertController } from 'ionic-angular';
import { BehaviorSubject } from "rxjs/BehaviorSubject";


@Injectable()
export class KeyBoardProvider {
  now: any = {};
  //keyboard_value
  keyboardValue: BehaviorSubject<string>;
  constructor(
    public AlertCtrl: AlertController,

  ) {
    this.keyboardValue = new BehaviorSubject('0');
  }
  getKeyboardValue() {
    return this.keyboardValue.asObservable();
  }
  setKeyboardValue(res) {
    this.set('keyboardValue', res);
  }
  set(key, res) {
    try {
      if (this[key].next) {
        this[key].next(res);
        this.now[key] = res;
      }
    } catch{
      delete this.now[key]
    }
  }
}
